package com.sy.controller;

import com.sy.entity.Demo;
import com.sy.service.DemoService;
import com.sy.utils.BilibiliUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zbbstart
 * @date 2021/1/12 - 14:55
 */
@RestController
public class DemoController {

    @Autowired
    private DemoService demoService;

    @RequestMapping(value = "demos", method = RequestMethod.GET)
    public List<Demo> getAllTests() {
        return demoService.getAllTests();
    }

    /**
     * 测试返回当前地址
     */
    @RequestMapping(value = "locates", method = RequestMethod.GET)
    public void locate() {
        String locate = BilibiliUtils.getLocate();
        String address = BilibiliUtils.getCurInetAddress();
        System.out.println(locate);
        System.out.println(address);
    }
}
